﻿using FarmSmartSleep.Common.Dtos;
using FarmSmartSleep.Organ.API.Application.InventoryCommands;
using FarmSmartSleep.Organ.API.Application.InventoryCommands.InventoryStatistics;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace FarmSmartSleep.Organ.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InventoryController : ControllerBase
    {
        private readonly IMediator mediator;

        public InventoryController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 分组统计
        /// </summary>
        /// <returns></returns>
        [HttpPost("GetGroupGender")]
        public async Task<Result> GetGroupGender(InventorySearchCommand cmd)
        {
            return await mediator.Send(cmd);
        }
        /// <summary>
        /// 求同比
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> CountSleep()
        {
            return await mediator.Send(new LiveStockSearchCommand());
        }
        /// <summary>
        /// 存栏统计
        /// </summary>
        /// <param name="enm"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> InventoryStatisticsCommons( InventoryStatisticsCommon enm)
        {
            return await mediator.Send(enm);
        }


    }
}
